/*
 * @Author: “ChengNan” 1429323234@qq.com
 * @Date: 2024-01-09 14:14:47
 * @LastEditors: ChengNan 1429323234@qq.com
 * @LastEditTime: 2024-08-13 10:50:32
 * @FilePath: /src/router/index.js
 * @Description: 
 */
import Vue, { reactive } from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: () => import('../views/HomeView.vue'),
    children: []
  },
  {
    path: '/tableSelect',
    name: 'tableSelect',
    component: () => import('../views/1.tableSelect/tableSelect.vue')
  },
  {
    path: '/keepAlive',
    name: 'keepAlive',
    component: () => import('../views/2.keepAlive/keepAlive.vue'),
    children:[
      {
        path: 'keepAlive1',
        name: 'keepAlive1',
        meta: {
          keepAlive: true
        },
        component: () => import('../views/2.keepAlive/keepAlive1.vue')
      },
      {
        path: 'keepAlive2',
        name: 'keepAlive2',
        meta: {
          keepAlive: true
        },
        component: () => import('../views/2.keepAlive/keepAlive2.vue')
      },

    ]
  },
  {
    path: '/$set',
    name: '$set',
    component: () => import('../views/3.$set/$set.vue')
  },
  {
    path: '/numberAnimation',
    name: 'numberAnimation',
    component: () => import('../views/4.numberAnimation/numberAnimation.vue')
  },
  {
    path: '/svg2img',
    name: 'svg2img',
    component: () => import('../views/5.svg2img/svg2img.vue')
  },
  {
    path: '/routerDO',
    name: 'RouterDO',
    component: () => import('../views/7.routerDO/routerDO.vue'),
    meta: {
      keepAlive: false,
      authorCode: 'admin'
    },
    // redirect: '/routerDO/child1',
    children: [
      {
        path: 'child1',
        name: 'Child1',
        component: () => import('../views/7.routerDO/children/child1.vue'),
        children: [
          {
            path: 'child1_1',
            name: 'Child1_1',
            component: () => import('../views/7.routerDO/children/child1_1.vue'),
          },
        ],
      },
      {
        path: 'child2',
        name: 'Child2',
        component: () => import('../views/7.routerDO/children/child2.vue'),
      },
    ]
  },
  {
    path: '/child3',
    name: 'Child3',
    component: () => import('../views/7.routerDO/children/child3.vue'),
    children: [
      {
        path: 'child2222',
        name: 'Child2',
        component: () => import('../views/7.routerDO/children/child2.vue'),
      },
      {
        path: '/child333/isaodhasoh/dsalushd',
        name: 'Child2',
        component: () => import('../views/7.routerDO/children/child2.vue'),
      },
    ]
  },
  {
    path: '/child4',
    name: 'Child4',
    component: () => import('../views/7.routerDO/children/child4.vue'),
    redirect: '/child4/child4_1',
    children: [
      {
        path: 'child4_1',
        name: 'Child4_1',
        component: () => import('../views/7.routerDO/children/child4_1.vue'),
      },
      {
        path: 'child4_2',
        name: 'Child4_2',
        component: () => import('../views/7.routerDO/children/child4_2.vue'),
      },
      {
        path: 'child4_3',
        name: 'Child4_3',
        component: () => import('../views/7.routerDO/children/child4_3.vue'),
      },
    ],
  },
  {
    path: '/displayFlex',
    name: 'displayFlex',
    component: () => import('../views/8.displayFlex/displayFlex.vue'),
  },
  {
    path: '/comRender',
    name: 'comRender',
    component: () => import('../views/9.comRender/comRender.vue'),
  },
  {
    path: '/virtualSelect',
    name: 'virtualSelect',
    component: () => import('../views/10.virtualSelect/virtualSelect.vue'),
  },
  {
    path: '/drawChart',
    name: 'drawChart',
    component: () => import('../views/11.drawChart/drawChart.vue'),
  },
]

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})


export default router
